//package cn.lingyangwl.agile.auth.constants.oauth2.support.core;
//
//import cn.lingyangwl.agile.auth.constants.oauth2.service.AuthenticatedUser;
//import cn.lingyangwl.agile.model.constants.SecurityCons;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.security.oauth2.server.authorization.token.OAuth2TokenClaimsContext;
//import org.springframework.security.oauth2.server.authorization.token.OAuth2TokenClaimsSet;
//import org.springframework.security.oauth2.server.authorization.token.OAuth2TokenCustomizer;
//
///**
// * token 输出增强
// *
// * @author shenguangyang
// */
//@Slf4j
//public class MyOAuth2TokenCustomizer implements OAuth2TokenCustomizer<OAuth2TokenClaimsContext> {
//
//	/**
//	 * Customize the OAuth 2.0 Token attributes.
//	 * @param context the context containing the OAuth 2.0 Token attributes
//	 */
//	@Override
//	public void customize(OAuth2TokenClaimsContext context) {
//		log.debug("oauth2 === context: {}", context);
//		OAuth2TokenClaimsSet.Builder claims = context.getClaims();
//		claims.claim(SecurityCons.DETAILS_LICENSE, SecurityCons.PROJECT_LICENSE);
//		String clientId = context.getAuthorizationGrant().getName();
//		claims.claim(SecurityCons.CLIENT_ID, clientId);
//		// 客户端模式不返回具体用户信息
//		if (SecurityCons.CLIENT_CREDENTIALS.equals(context.getAuthorizationGrantType().getValue())) {
//			return;
//		}
//		AuthenticatedUser authenticatedUser = (AuthenticatedUser) context.getPrincipal().getPrincipal();
//		claims.claim(SecurityCons.DETAILS_USER, authenticatedUser);
//	}
//
//}
